home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / network / ncsasock / a_tftp.h < prev    next >
Text File  |  1996-07-05  |  2KB  |  62 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that: (1) source distributions retain this entire copyright
  7.  * notice and comment, and (2) distributions including binaries display
  8.  * the following acknowledgement:  ``This product includes software
  9.  * developed by the University of California, Berkeley and its contributors''
  10.  * in the documentation or other materials provided with the distribution
  11.  * and in all advertising materials mentioning features or use of this
  12.  * software. Neither the name of the University nor the names of its
  13.  * contributors may be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  *
  19.  *    @(#)tftp.h    5.3 (Berkeley) 6/1/90
  20.  */
  21.  
  22. /*
  23.  * Trivial File Transfer Protocol (IEN-133)
  24.  */
  25. #define    SEGSIZE        512        /* data segment size */
  26.  
  27. /*
  28.  * Packet types.
  29.  */
  30. #define    RRQ    01            /* read request */
  31. #define    WRQ    02            /* write request */
  32. #define    DATA    03            /* data packet */
  33. #define    ACK    04            /* acknowledgement */
  34. #define    ERROR    05            /* error code */
  35.  
  36. struct    tftphdr {
  37.     short    th_opcode;        /* packet type */
  38.     union {
  39.         short    tu_block;    /* block # */
  40.         short    tu_code;    /* error code */
  41.         char    tu_stuff[1];    /* request packet stuff */
  42.     } th_u;
  43.     char    th_data[1];        /* data or error string */
  44. };
  45.  
  46. #define    th_block    th_u.tu_block
  47. #define    th_code        th_u.tu_code
  48. #define    th_stuff    th_u.tu_stuff
  49. #define    th_msg        th_data
  50.  
  51. /*
  52.  * Error codes.
  53.  */
  54. #define    EUNDEF        0        /* not defined */
  55. #define    ENOTFOUND    1        /* file not found */
  56. #define    EACCESS        2        /* access violation */
  57. #define    ENOSPACE    3        /* disk full or allocation exceeded */
  58. #define    EBADOP        4        /* illegal TFTP operation */
  59. #define    EBADID        5        /* unknown transfer ID */
  60. #define    EEXISTS        6        /* file already exists */
  61. #define    ENOUSER        7        /* no such user */
  62.